using System;
using System.Collections.Generic;
using System.Text;
using Impact.Model.Objects;
using Impact.Model.Service;


namespace Impact.UnitTests.Mocks
{
    public class MockCategoryService : ICategoryService
    {

        public MockCategoryService()
        {
            categories = new ArticleCategoryCollection();

            ArticleCategory one = new ArticleCategory();
            one.CategoryId = 1;
            one.Name = "won";
            one.NameKey = "one";
            one.MenuVisible = true;
            categories.Add(one);

            ArticleCategory two = new ArticleCategory();
            two.CategoryId = 2;
            two.Name = "too";
            two.NameKey = "two";
            two.MenuVisible = true;
            categories.Add(two);

            ArticleCategory three = new ArticleCategory();
            three.CategoryId = 3;
            three.Name = "free";
            three.NameKey = "three";
            three.MenuVisible = true;
            categories.Add(three);

        }

        private ArticleCategoryCollection categories;
        public ArticleCategoryCollection Categories
        {
            get { return categories; }
        }


        #region ICategoryService Members

        public ArticleCategory FetchByID(int categoryId)
        {
            return categories.GetList().Find(delegate(ArticleCategory category)
            {
                return category.CategoryId == categoryId;
            });
        }

        public ArticleCategory FetchByKey(string categoryKey)
        {
            return categories.GetList().Find(delegate(ArticleCategory category)
            {
                return category.NameKey.Equals(categoryKey, StringComparison.CurrentCultureIgnoreCase);
            });
        }

        public ArticleCategoryCollection FetchAll(bool onlyVisible)
        {
            return categories;
        }

        public void Save(ArticleCategory category, Guid guid)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public void Remove(int categoryId)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public int GetCategoryArticleCount(int categoryId)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        #endregion
    }
}
